package com.qingke.pms.command;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.qingke.pms.dao.ProjectManagementSystemDAO;
import com.qingke.pms.pojo.Project;
import com.qingke.pms.pojo.PurchaseOrderStatus;
import com.qingke.pms.pojo.PurchasePlanStatus;
import com.qingke.pms.pojo.RequisitionOrderStatus;
import com.qingke.pms.pojo.User;

public abstract class ProjectCommand extends UserCommand {
	protected Project project;
	protected static Map<String,PurchasePlanStatus> ppsMap;
	protected static Map<String,PurchaseOrderStatus> posMap;
	protected static Map<String,RequisitionOrderStatus> rosMap;
	public ProjectCommand(User user,Project project) {
		super(user);
		this.project=project;
	}
	static{
		ppsMap=new HashMap<>();
		posMap=new HashMap<>();
		rosMap=new HashMap<>();
		ProjectManagementSystemDAO dao=new ProjectManagementSystemDAO();
		List<PurchasePlanStatus> ppsList=dao.selectAllPurchasePlanStatuses();
		List<PurchaseOrderStatus> posList=dao.selectAllPurchaseOrderStatuses();
		List<RequisitionOrderStatus> rosList=dao.selectAllRequisitionOrderStatuses();
		for(PurchasePlanStatus pps:ppsList){
			ppsMap.put(pps.getCode(),pps);
		}
		for(PurchaseOrderStatus pos:posList){
			posMap.put(pos.getCode(),pos);
		}
		for(RequisitionOrderStatus ros:rosList){
			rosMap.put(ros.getCode(),ros);
		}
	}
}
